package com.salt.modules.experience.service;

import com.salt.common.service.CrudService;
import com.salt.common.utils.DateUtils;
import com.salt.common.utils.IdGen;
import com.salt.modules.experience.entity.SysExperience;
import com.salt.modules.experience.mapper.SysExperienceMapper;
import com.salt.modules.sys.utils.UserUtils;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Description 体验
 * @Author zy
 * @Date 2023-02-10
 * @Version 1.0.1
 */
@Service
@AllArgsConstructor
@Transactional(readOnly = false)
public class SysExperienceService extends CrudService<SysExperienceMapper, SysExperience> {

    @Autowired
    private SysExperienceMapper mapper;

    public void insert(SysExperience data){

        data.setId(IdGen.uuid());
        data.setCreateTime(DateUtils.getDateTime());
        data.setFounder(UserUtils.getUser().getName());

        mapper.insert(data);
    }

    public void deleteById(String id) {
        mapper.deleteById(id);
    }
}
